package com.dongnao.jack.loadbalance;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

public class BalanceFactory {

    private static Map<String, Balance> balanceMap = new HashMap<String, Balance>();

    static {
        balanceMap.put("random", new RandomBalance());

        balanceMap.put("poll", new PollBalance());
    }

    public static Balance getBalance(String type) {

        if (StringUtils.isNoneBlank(type)) {
            return balanceMap.get(type);
        }

        return null;

    }

}
